package com.controller;

import com.service.IUserService;
import com.service.impl.UserServiceImpl;
import com.vo.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * InnoDB free: 4096 kB 前端控制器
 * </p>
 *
 * @author zzw
 * @since 2022-05-12
 */
@RestController
@RequestMapping("//user")
public class UserController {
    @Resource
    public IUserService userService;
    private Logger logger= LoggerFactory.getLogger( UserServiceImpl.class );

    @RequestMapping("/login")  //http://127.0.0.1/user/user/login
    public Result login(@RequestParam("phone") String phone, @RequestParam("password") String password){
        Result result=userService.login(phone,password);
        return result ;
    }

    @RequestMapping("/register")
    @ResponseBody
    public Result user(@RequestParam("password") String password,@RequestParam("phone") String phone) {
        Result result=userService.register(password,phone);
        return result;
    }
}

